//---------------------------------------------------------------------------

#ifndef CIISDecayH
#define CIISDecayH

#include "CIISDB.h"
#include "USBCANInterface.h"

//---------------------------------------------------------------------------

const DecayDelay = 500;
const IniSampMaxInterval = 2000;
const NoOfIniSamp = 10;


enum DecayState { DecayStart, DecayPowerOff, IniDecaySample, DecaySample, DecayEnd };

class TCIISDecay : public TObject
{
private:
  TCIISDBModule *DB;
  TUSBCANInterface *CAN;
  TDebugWin *DW;
  Word ZoneCanAdr;
  String Ctrl;
  TLocateOptions NoOpts;
  DecayState DState;
	int T, TNextEvent, TDuration, DecaySampInterval, DecayDuration;
	int IniSamp, IniSampInterval;
  bool SkipPowerOn;

        int FZoneNo;
        int FRecNo;
        bool FDecayReady;
        void __fastcall RequestSample();
        void __fastcall RequestPSOff();
        void __fastcall RequestPSOn();
        void __fastcall Debug(String Message);
        
public:
        __fastcall TCIISDecay( TCIISDBModule *SetDB,
                               TUSBCANInterface *SetCAN,
                               TDebugWin *SetDebugWin,
                               int SetZoneNo,
                               String SetCtrl);
        __fastcall ~TCIISDecay();
   void __fastcall OnTimerEvent();
        void __fastcall SetDebugWin(TDebugWin * SetDebugWin);

__published:
        __property int ZoneNo  = { read=FZoneNo };
        __property int RecNo  = { read=FRecNo };
				__property bool DecayReady  = { read=FDecayReady };

};



#endif
